package com.crwal.app.utils;


import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Map;

import com.crwal.app.bean.CrwalUrl;

import cn.hutool.core.io.FileUtil;


public class WordCounterUtils {
	
    public static void keyWordCounter(String textLine, Map<String, Integer> keyWordCount){
        int pos = textLine.indexOf("//");
        if(pos == -1) {
            pos = textLine.length();
        }
        String sub = textLine.substring(0, pos);
        String sub1 = sub.replaceAll("\\W", " ");
        String str = sub1.replaceAll(" +", " ");
        String[] s1 = str.split(" ");
        Integer freq;
        for(String word : s1) {
            freq = keyWordCount.get(word);
            if(freq != null) {
                freq = new Integer(freq.intValue() + 1);
                keyWordCount.put(word, freq);
            }
        }
    }
    
    public static void main(String[] args ) throws Exception {
	    //String toParse = "Mo Aug 18 11:25:26 MESZ +0200 2014";
	    //String pattern = "EEE MMM dd HH:mm:ss z Z yyyy";
	    String toParse = "19 Mai 2021";
	    String pattern = "dd MMM yyyy";

	    DateFormat dateFormatter = new SimpleDateFormat(pattern, Locale.GERMANY);
	    Date date = dateFormatter.parse(toParse);
	    System.out.println(date);
	    //System.out.println(DateUtil.formatDate(date));
	    System.out.println( FileUtil.del("G:/crwalapp/export/basf.xls"));
    }

}
